var checkParentCategoryType = function(option) {
	var selectedCategoryId = option.val();
	var data = {
		category_id: selectedCategoryId
	};
	$.post('/admin/ajax/check-parent-category-type', data, function(r) {
		r = JSON.parse(r);
		if (r.result == 'error') {
			$.jGrowl(r.message);                    
            option.attr('disabled', 'disabled');
            option.css({color: 'red'});
		}			
	})
}

$('select[name="category"]').live('change', function() {
	var option = $('select[name="category"] option:selected');
	checkParentCategoryType(option);
})
